<?php
	$path_one = 'admin/admin_project';
	$path_two = 'admin/admin_project_manage';
	$filename = 'admin/admin_project_list';
	require_once("header.php");
	require_once("admin_comm.php");
	require_once $_site->get_handlepath('device');
	$page = request('page',false,true,false,1);
	$pagesize = request('pagesize',false,true,false,10);
	$title = request('device_no');
	$state = 1;
	$data = compact('title','state');
	
	$admin_obj = new admin();
	$user_info = $admin_obj->out_cookie();
	if(6!==$user_info){
		$data['manage']=$user_info['id'];
	}	
	
	$result = device_fun_get_device_list($data,$page,$pagesize);

?>
<script type="text/javascript">
  loader.file({
	  skincss:['list']
  })
  $(document).ready(function(){  
  	  $('#device_choose dt').click(function(){
		  $('#device_choose dt').removeClass('seltd');
		  $(this).addClass('seltd');
	  });
  })
  
  function finish(){
	  var device = $("#device_choose").find('dt.seltd');
	  parent.choose_device(device);
	  parent.dialog.close('device_dialog');
  }
</script>
<style type="text/css">

.wai{ width:100%; float:left; }

.wai select{ margin-bottom:5px;}

.main dl{ width:100%; float:left; padding:10px 0px;}

.main dl dt{ float:left; font-size:14px; padding:3px 5px; margin:5px; cursor:pointer; display: inline;background: #D1D7D7;}

.main dl dt:hover{ background-color:#1aa418; color:#FFFFFF;}

.main dl dt.seltd{background-color:#1aa418; color:#FFFFFF}

</style>
</head>
<body>
	<div class="main" style=" float:left;">
		<div  class="sos_box" style=" float:left;">
			<form action="" method="post" id="form1">
                <div class="wai">
                	<span style=" float:left; line-height: 27px;">设备编号：</span>
					<input class="input ipt6" type="text" name="device_no" id="device_no"/>
                	<input class="button1" type="submit" value="搜索">
                </div>
			</form>
		</div>
		<dl id="device_choose" style=" float:left;border: 1px solid #dce3ed;">
			<?php  
				if($result['rows']){
					foreach($result['rows'] as $v){
						echo "<dt device_id='{$v['id']}'>{$v['no']}</dt>";
					}
				}else{
					echo '<span>没有可绑定的设备</span>';
				}
			?>
		</dl>
        <div>
			<input class="button1" type="button" value="选择" onClick="finish();">
		</div>
		<div class="list_more">
			设备总数：<font id="total_device"><?php echo $result['row_count']?$result['row_count']:0 ;?></font>
			<?php
				echo page_method($result['row_count'], $page, $result['page_count'], 0, '?'.preg_replace('/(&page=\d*)/','',$_SERVER['QUERY_STRING']), false);
			?>
		</div>
		
	</div>
</body>
</html>
